<template>
  <div id="supervise">
    <div class="homeTitle">监管评级权限设置</div>
    <div class="bottomTable">
      <div class="table">
        <table>
          <tr>
            <td>监管评级</td>
            <td>业务</td>
            <td  style="width: 60%;">资产购买权限</td>
            <td>操作</td>
          </tr>
          <tr v-for="(item, index) in tableBottom" :key="index">
            <td>{{item.rating}}</td>
            <td>{{item.professionalWork}}</td>
            <td v-if="item.professionalWork == '债券'">
              <p v-if="item.rankList.length !== 0"><span>可用债券评级：{{item.rankList.join('，')}}</span></p>
              <p v-if="item.natureList.length !== 0"><span>可用债券性质：{{item.natureList.join('，')}}</span></p>
            </td>
            <td v-if="item.professionalWork == '理财产品'">
              <p v-if="item.rankList.length !== 0"><span>可用资产风险评级：{{item.rankList.join('，')}}</span></p>
              <p v-if="item.natureList.length !== 0"><span>可用资产性质：{{item.natureList.join('，')}}</span></p>
            </td>
            <td>
              <el-button type="primary" size="small" @click="peizhi(item,index)">配置等级权限</el-button>
              <el-button type="primary" size="small" @click="Nature(item,index)">配置性质权限</el-button>
            </td>
          </tr>
        </table>
      </div>
    </div>
    <div class="btn">
      <el-button type="primary" size='small' @click="$router.go(-1)">关闭</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'supervise',
  data () {
    return {
      tableBottom: []
    };
  },
  mounted () {
    this.getdata();
  },
  methods: {
    getdata () {
      this.axios.get('superviseRating/findAll')
        .then(({data})=> {
          if (data.code == 200) {
            this.tableBottom = data.data;
          }
        })
    },
    peizhi (item) {
      this.$router.push({path: 'Grade', query: {id: item.id, status: item.professionalWork}});
    },
    Nature (item) {
      this.$router.push({path: 'Nature', query: {id: item.id, status: item.professionalWork}});
    },
    addjuese() {
      this.$router.push('addColumn');
    }
  }
};
</script>

<style lang="scss">
  #supervise {
    .bottomTable {
      margin-top: 20px;
    table {
      border: 1px solid white;
      width: 100%;
      border-collapse: collapse;
      tr {
        &:first-child {
          background-color: #181C1D !important;;
          color: white;
          td {
            background-color: #181C1D !important;
          }
        }
        td {
          text-align: center;
          padding: 5px 10px;
          border-right: 1px solid white;
          border-bottom: 1px solid white;
          color: white;
          background: rgba(58, 58, 58, 0.65)
        }
    }
    }
    .addwhite {
      height: 46px;
      background-color: white;
      padding: 0 20px;
      span {
        color: #cccccc;
        line-height: 46px;
      }
    }
  }
  .btn {
    text-align: center;
    margin: 20px 0;
  }
  }
</style>
